package model

import (
	"time"
)

type Account struct {
	AccountId int64 `xorm:"pk autoincr"`
	DepartMentId int64
	AccountName string
	Level int
	LineType int
	Incumbency int
	CreatedAt time.Time
  	UpdatedAt time.Time
}

func (at *Account)InsertAccount(a *Account) map[string]interface{}{
	x.Insert(a)
	return map[string]interface{}{"message": "成功","code":"200"}
}

func (at *Account)QueryAccountById(aId int64) Account{
	var a Account
	x.Id(aId).Get(&a)
	var da Account
	x.Where("depart_ment_id = ?", a.DepartMentId).And("Level = ?", 2).Get(&da)
	return da
}

func (at *Account)QueryAccountOne(aId int64) Account{
	var a Account
	x.Id(aId).Get(&a)
	return a
}